<template>
  <div>
    <div class="modal">
      <div class="modal-bg" @click="GuestClose"></div>
      <div class="Htran">
        <div class="rele-titles">
          跟进编辑
          <div class="right-images">
            <div>
              <img @click="GuestClose" src="../assets/img/tub.png" alt="">
            </div>

          </div>
        </div>
        <div class="li-p">
          <div class="Htran-li">
            <div class="Htran-b-li">
              <div class="Htran-b-name">
                跟进方式
              </div>
              <div class="Htran-b-input">
                <select  v-model="record.mode_id" placeholder="请选择" style="width: 250%;height: 28px;">
                  <option
                    v-for="item in follow"
                    :key="item.id"
                    :label="item.title"
                    :value="item.id">
                  </option>
                </select>
              </div>
            </div>

            <div class="Htran-b-li">
              <div class="Htran-b-name">
                跟进内容
              </div>
              <div class="Htran-b-input">
                <el-input
                  type="textarea"
                  :rows="6"
                  v-model="record.content"
                  placeholder="请输入内容"
                  style="width:250%;border: 1px solid #a0a0a0; cursor:pointer;!important;">
                </el-input>
              </div>
            </div>
          </div>
          <div class="btn">
            <el-button  type="primary" @click="guestSubmit" style="margin-left: 30%;position: absolute;" >保存</el-button>
          </div>
        </div>
      </div>

    </div>
  </div>
</template>
<script type="text/babel">
  export default {
    props:{
      LDmodal:{
        type:Function
      },
      GuestClose:{
        type:Function
      },
      ids:{

      }
    },
    data () {
      return {

        record:{},
        follow:[]
      }
    },
    watch:{
      'ids'(){
        this.getFollowList();
        this.getFollowRecord(this.ids);
      }
    },
    computed:{

    },
    methods: {
      //获取跟进来列表
      getFollowList:function(){
        let _this = this;
        this.$http('/index/house_up/mode').then((res)=>{
          _this.follow = res.data
        })
      },
      //获取跟进记录
      getFollowRecord(id){
        let _this = this;
        this.$http.get('/index/house_up/'+id).then((res)=>{
          _this.record = res.data;
        })
      },
      //提交
      guestSubmit(){
        let _this = this;
        this.$http.post('/index/house_up/edit/'+this.ids,{
          content:_this.record.content,
          mode_id:_this.record.mode_id
        }).then((res)=>{
          alert(res.data.msg);
        })
      }
    }
  }
</script>
<style scoped>

  .btn{
    margin-top: 30px;
    width: 90%;
    padding: 0 5%;
    float: left;
  }
  .btn button{
    width: 100px;
    color: #fff;
    height:35px;
    border:none;
    border-radius: 5px;
  }
  .btn button:nth-child(2){
    float: right;
  }
  .Htran-b-name{
    width: 35%;
    text-align: center;
    float: left;
    line-height: 27px;
  }
  .Htran-b-input{
    width: 65%;
    float: left;
  }
  .Htran-b-input input{
    width: 100%;
    line-height: 27px;
    box-sizing: border-box;
  }
  .li-p{
    width: 94%;
    float: left;
    padding: 0 3%;
  }
  .Htran-b-li{
    margin-top: 10px;
    width: 100%;
    float: left;
  }
  .Htran-li{
    margin-top: 15px;
    width: 50%;
    float: left;
  }
  .Htran-input input{
    width: 100%;
    float: left;
    border:none;
    line-height: 27px;
    border-bottom: 1px solid  #d3d3d3;
  }
  .Htran{
    width:350px;
    height: 340px;
    border-radius: 5px;
    overflow: hidden;
    background: #fff;
    position:absolute;
    top: 50%;
    margin-top: -180px;
    left:50%;
    margin-left:-175px;
    z-index: 10;
    box-shadow: #e8e7e7 0px 0px 10px;
  }

  .rele-titles {
    width:100%;
    padding: 0 3%;
    line-height: 50px;
    font-size: 2em;
    color: #000;
    background: #f5f5f7;
    z-index: 9;
    border-bottom: 1px solid #d3d3d3;
    position: relative;

  }
  .rele-titles img{
    right: 20px;
    position: relative;
  }
  .right-images{
    position: absolute;
    right:0;
    top:0;
    width:30px;
    height:50px;
    cursor:pointer;
  }
  .right-images div img{
    vertical-align:middle;
    cursor: pointer;
  }
  select{
    cursor:pointer;
  }
</style>
